/*!
https://gitee.com/uqbn/labs/raw/master/unit2/main.c
*/
#include "main.h"

static void delay(uint16_t xms);

static void delay(uint16_t xms)
{
    uint16_t i, j;
    for (i = xms; i; --i)
    {
        for (j = 112U; j; --j)
        {
        }
    }
}

int main(void)
{
    P1 = 0x0FU;

    SET_BIT(TCON, EXTI0_TRIGGER);
    SET_BIT(IE, EXTI0_ENABLE | INT_ENABLE);

    for (;;)
    {
    }
}

void toggle() __interrupt(IE0_VECTOR)
{
    delay(10);
    if (!P3_2)
    {
        P1 = ~P1;
    }
}

/* END OF FILE */
